Optimal. Leaf size=97 \[ \frac {x}{(a-b)^2}+\frac {(3 a-b) \sqrt {b} \text {ArcTan}\left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} (a-b)^2 d}+\frac {b \cot (c+d x)}{2 a (a-b) d \left (a+b \cot ^2(c+d x)\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 97, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.357, Rules used = {3742, 425, 536,
209, 211} \begin {gather*} \frac {\sqrt {b} (3 a-b) \text {ArcTan}\left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} d (a-b)^2}+\frac {b \cot (c+d x)}{2 a d (a-b) \left (a+b \cot ^2(c+d x)\right )}+\frac {x}{(a-b)^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 211
Rule 425
Rule 536
Rule 3742
Rubi steps
\begin {align*} \int \frac {1}{\left (a+b \cot ^2(c+d x)\right )^2} \, dx &=-\frac {\text {Subst}\left (\int \frac {1}{\left (1+x^2\right ) \left (a+b x^2\right )^2} \, dx,x,\cot (c+d x)\right )}{d}\\ &=\frac {b \cot (c+d x)}{2 a (a-b) d \left (a+b \cot ^2(c+d x)\right )}-\frac {\text {Subst}\left (\int \frac {2 a-b-b x^2}{\left (1+x^2\right ) \left (a+b x^2\right )} \, dx,x,\cot (c+d x)\right )}{2 a (a-b) d}\\ &=\frac {b \cot (c+d x)}{2 a (a-b) d \left (a+b \cot ^2(c+d x)\right )}-\frac {\text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\cot (c+d x)\right )}{(a-b)^2 d}+\frac {((3 a-b) b) \text {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\cot (c+d x)\right )}{2 a (a-b)^2 d}\\ &=\frac {x}{(a-b)^2}+\frac {(3 a-b) \sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a}}\right )}{2 a^{3/2} (a-b)^2 d}+\frac {b \cot (c+d x)}{2 a (a-b) d \left (a+b \cot ^2(c+d x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.96, size = 90, normalized size = 0.93 \begin {gather*} \frac {-2 \text {ArcTan}(\cot (c+d x))+\frac {(3 a-b) \sqrt {b} \text {ArcTan}\left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a}}\right )}{a^{3/2}}+\frac {(a-b) b \cot (c+d x)}{a \left (a+b \cot ^2(c+d x)\right )}}{2 (a-b)^2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.33, size = 99, normalized size = 1.02
method | result | size |
derivativedivides | \(\frac {\frac {b \left (\frac {\left (a -b \right ) \cot \left (d x +c \right )}{2 a \left (a +b \left (\cot ^{2}\left (d x +c \right )\right )\right )}+\frac {\left (3 a -b \right ) \arctan \left (\frac {b \cot \left (d x +c \right )}{\sqrt {a b}}\right )}{2 a \sqrt {a b}}\right )}{\left (a -b \right )^{2}}-\frac {\frac {\pi }{2}-\mathrm {arccot}\left (\cot \left (d x +c \right )\right )}{\left (a -b \right )^{2}}}{d}\) | \(99\) |
default | \(\frac {\frac {b \left (\frac {\left (a -b \right ) \cot \left (d x +c \right )}{2 a \left (a +b \left (\cot ^{2}\left (d x +c \right )\right )\right )}+\frac {\left (3 a -b \right ) \arctan \left (\frac {b \cot \left (d x +c \right )}{\sqrt {a b}}\right )}{2 a \sqrt {a b}}\right )}{\left (a -b \right )^{2}}-\frac {\frac {\pi }{2}-\mathrm {arccot}\left (\cot \left (d x +c \right )\right )}{\left (a -b \right )^{2}}}{d}\) | \(99\) |
risch | \(\frac {x}{a^{2}-2 a b +b^{2}}-\frac {i b \left (a \,{\mathrm e}^{2 i \left (d x +c \right )}+b \,{\mathrm e}^{2 i \left (d x +c \right )}-a +b \right )}{d a \left (-a +b \right )^{2} \left (-a \,{\mathrm e}^{4 i \left (d x +c \right )}+b \,{\mathrm e}^{4 i \left (d x +c \right )}+2 a \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b \,{\mathrm e}^{2 i \left (d x +c \right )}-a +b \right )}+\frac {3 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-a b}+a +b}{a -b}\right )}{4 a \left (a -b \right )^{2} d}-\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-a b}+a +b}{a -b}\right ) b}{4 a^{2} \left (a -b \right )^{2} d}-\frac {3 \sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-a b}-a -b}{a -b}\right )}{4 a \left (a -b \right )^{2} d}+\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-a b}-a -b}{a -b}\right ) b}{4 a^{2} \left (a -b \right )^{2} d}\) | \(335\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 115, normalized size = 1.19 \begin {gather*} \frac {\frac {b \tan \left (d x + c\right )}{a^{2} b - a b^{2} + {\left (a^{3} - a^{2} b\right )} \tan \left (d x + c\right )^{2}} - \frac {{\left (3 \, a b - b^{2}\right )} \arctan \left (\frac {a \tan \left (d x + c\right )}{\sqrt {a b}}\right )}{{\left (a^{3} - 2 \, a^{2} b + a b^{2}\right )} \sqrt {a b}} + \frac {2 \, {\left (d x + c\right )}}{a^{2} - 2 \, a b + b^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 209 vs.
\(2 (85) = 170\).
time = 3.06, size = 534, normalized size = 5.51 \begin {gather*} \left [\frac {8 \, {\left (a^{2} - a b\right )} d x \cos \left (2 \, d x + 2 \, c\right ) - 8 \, {\left (a^{2} + a b\right )} d x + {\left (3 \, a^{2} + 2 \, a b - b^{2} - {\left (3 \, a^{2} - 4 \, a b + b^{2}\right )} \cos \left (2 \, d x + 2 \, c\right )\right )} \sqrt {-\frac {b}{a}} \log \left (\frac {{\left (a^{2} + 6 \, a b + b^{2}\right )} \cos \left (2 \, d x + 2 \, c\right )^{2} + 4 \, {\left (a^{2} - a b - {\left (a^{2} + a b\right )} \cos \left (2 \, d x + 2 \, c\right )\right )} \sqrt {-\frac {b}{a}} \sin \left (2 \, d x + 2 \, c\right ) + a^{2} - 6 \, a b + b^{2} - 2 \, {\left (a^{2} - b^{2}\right )} \cos \left (2 \, d x + 2 \, c\right )}{{\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (2 \, d x + 2 \, c\right )^{2} + a^{2} + 2 \, a b + b^{2} - 2 \, {\left (a^{2} - b^{2}\right )} \cos \left (2 \, d x + 2 \, c\right )}\right ) - 4 \, {\left (a b - b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{8 \, {\left ({\left (a^{4} - 3 \, a^{3} b + 3 \, a^{2} b^{2} - a b^{3}\right )} d \cos \left (2 \, d x + 2 \, c\right ) - {\left (a^{4} - a^{3} b - a^{2} b^{2} + a b^{3}\right )} d\right )}}, \frac {4 \, {\left (a^{2} - a b\right )} d x \cos \left (2 \, d x + 2 \, c\right ) - 4 \, {\left (a^{2} + a b\right )} d x - {\left (3 \, a^{2} + 2 \, a b - b^{2} - {\left (3 \, a^{2} - 4 \, a b + b^{2}\right )} \cos \left (2 \, d x + 2 \, c\right )\right )} \sqrt {\frac {b}{a}} \arctan \left (\frac {{\left ({\left (a + b\right )} \cos \left (2 \, d x + 2 \, c\right ) - a + b\right )} \sqrt {\frac {b}{a}}}{2 \, b \sin \left (2 \, d x + 2 \, c\right )}\right ) - 2 \, {\left (a b - b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, {\left ({\left (a^{4} - 3 \, a^{3} b + 3 \, a^{2} b^{2} - a b^{3}\right )} d \cos \left (2 \, d x + 2 \, c\right ) - {\left (a^{4} - a^{3} b - a^{2} b^{2} + a b^{3}\right )} d\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 2125 vs.
\(2 (78) = 156\).
time = 9.36, size = 2125, normalized size = 21.91 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.47, size = 123, normalized size = 1.27 \begin {gather*} -\frac {\frac {{\left (\pi \left \lfloor \frac {d x + c}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (d x + c\right )}{\sqrt {a b}}\right )\right )} {\left (3 \, a b - b^{2}\right )}}{{\left (a^{3} - 2 \, a^{2} b + a b^{2}\right )} \sqrt {a b}} - \frac {2 \, {\left (d x + c\right )}}{a^{2} - 2 \, a b + b^{2}} - \frac {b \tan \left (d x + c\right )}{{\left (a \tan \left (d x + c\right )^{2} + b\right )} {\left (a^{2} - a b\right )}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.79, size = 119, normalized size = 1.23 \begin {gather*} \frac {\frac {a\,x}{{\left (a-b\right )}^2}+\frac {b\,x\,{\mathrm {cot}\left (c+d\,x\right )}^2}{{\left (a-b\right )}^2}+\frac {b\,\mathrm {cot}\left (c+d\,x\right )}{2\,a\,d\,\left (a-b\right )}}{b\,{\mathrm {cot}\left (c+d\,x\right )}^2+a}+\frac {\mathrm {atan}\left (\frac {b\,\mathrm {cot}\left (c+d\,x\right )}{\sqrt {a\,b}}\right )\,\left (3\,a\,b-b^2\right )}{\sqrt {a\,b}\,\left (2\,a^3\,d-a\,b\,\left (4\,a\,d-2\,b\,d\right )\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________